package com.shensi.api.admin.client.system;

import com.shensi.api.admin.client.fallback.system.SysDicTypeClientFallBack;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.domain.entity.SysDictType;
import com.shensi.common.core.page.TableDataInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = SysDicTypeClientFallBack.class)
@Component
public interface SysDicTypeClient {

    @GetMapping("/list")
    public TableDataInfo list(@SpringQueryMap SysDictType dictType);

    @GetMapping("/export")
    public AjaxResult export(@SpringQueryMap SysDictType dictType);

    /**
     * 查询字典类型详细
     */
    @GetMapping(value = "/{dictId}")
    public AjaxResult getInfo(@PathVariable("dictId") Long dictId);

    /**
     * 新增字典类型
     */
    @PostMapping
    public AjaxResult add(@RequestBody SysDictType dict);

    /**
     * 修改字典类型
     */
    @PutMapping
    public AjaxResult edit(@RequestBody SysDictType dict);

    /**
     * 删除字典类型
     */
    @DeleteMapping("/{dictIds}")
    public AjaxResult remove(@PathVariable("dictIds") Long[] dictIds);

    /**
     * 清空缓存
     */
    @DeleteMapping("/clearCache")
    public AjaxResult clearCache();

    /**
     * 获取字典选择框列表
     */
    @GetMapping("/optionselect")
    public AjaxResult optionselect();
}
